package com.savi.myapplication.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.ArrayList;
import java.util.List;


/**
 * Copyright (c) 2011,
 * All rights reserved.
 *
 * @file DocTabFragmentAdapter.java
 * @brief
 *       资料界面适配器
 * @author miao  @version V1.0     @date 2022-09-30
 *
 */
public class ToDoTabFragmentAdapter extends FragmentStateAdapter {


    List<Fragment> fragmentList = new ArrayList<>();


    public ToDoTabFragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle, List<Fragment> fragmentList) {
        super(fragmentManager, lifecycle);
        this.fragmentList = fragmentList;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getItemCount() {
        return fragmentList != null ? fragmentList.size() : 0;
    }

    @Override
    public long getItemId(int position) {
        return super.getItemId(position);
    }

}
